<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '回收站';
$this->params['breadcrumbs'][] = ['label' => '系统管理', 'template' => "<li><a>{link}</a></li>\n"];
$this->params['breadcrumbs'][] = ['label' => '菜单管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$this->context->fadeType = 'fadeIn';
?>

<?php Pjax::begin(); ?>
<div class="ibox">
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'options' => [
            'class' => 'ibox-content',
        ],
        'tableOptions' => [
            'class' => 'footable table table-stripped toggle-arrow-tiny',
        ],
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'parent_id',
            'name',
            'status',

            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{restore} {delete}',
                'buttons' => [
                    'restore' => function ($url, $model, $key) {
                        $options = [
                            'title' => '还原',
                            'aria-label' => '还原',
                            'data-confirm' => '确定要还原这个菜单吗？',
                            'data-method' => 'post',
                            'data-pjax' => '0',
                        ];
                        return Html::a('<span class="glyphicon glyphicon-refresh"></span>', $url, $options);
                    },
                    'remove' => function ($url, $model, $key) {
                        $options = [
                            'title' => '彻底删除',
                            'aria-label' => '彻底删除',
                            'data-confirm' => '确定要彻底删除这个菜单吗？',
                            'data-method' => 'post',
                            'data-pjax' => '0',
                        ];
                        return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options);
                    }
                ]
            ],
        ],
    ]); ?>
</div>
<?php Pjax::end(); ?>
